using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DamageText : MonoBehaviour
{
    public Text text;
    public float upSpeed;
    public float missSpeed;

    public void ChangeText(int textInt)
    {
        text.text = "-"+textInt.ToString();
    }

    private void Update()
    {
        transform.position += new Vector3(0, 1, 0) *Time.deltaTime* upSpeed;
        if(text.color.a>0)
        {
            float a = text.color.a;
            a -= Time.deltaTime * missSpeed;
            text.color = new Color(text.color.r, text.color.g, text.color.b, a);
        }
        else
        {
            Destroy(this);
        }
    }
}
